package com.example.chapter04;

import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;

public class ActStartActivity extends AppCompatActivity implements View.OnClickListener {

    private static final String TAG = "ning";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //日志
        Log.d(TAG, "ActStartActivity onCreate");

        setContentView(R.layout.activity_act_start);
        findViewById(R.id.btn_act_next).setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        //显示Intent
        //第一种方式,在Intent的构造函数中指定
        //Intent intent = new Intent(this, ActFinishActivity.class);

        //第二种方式：调用意图对象的setClass方法
        //Intent intent = new Intent();
        //intent.setClass(this, ActFinishActivity.class);

        //第三种方式：调用意图对象的setComponent方法
        ComponentName component = new ComponentName(this, ActFinishActivity.class);
        Intent intent = new Intent();
        intent.setComponent(component);
        startActivity(intent);
    }

    @Override
    protected void onStart() {
        super.onStart();
        Log.d(TAG, "ActStartActivity onStart");
    }

    @Override
    protected void onResume() { //中断后重新开始，继续  此方法过后此时可见
        super.onResume();
        Log.d(TAG, "ActStartActivity onResume");
    }

    @Override
    protected void onPause() { //此方法过后不可见
        super.onPause();
        Log.d(TAG, "ActStartActivity onPause");
    }

    @Override
    protected void onStop() {
        super.onStop();
        Log.d(TAG, "ActStartActivity onStop"); //不可见之后
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        Log.d(TAG, "ActStartActivity onRestart");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.d(TAG, "ActStartActivity onDestroy");
    }


}